!function(a){a(document).ready(function(){a(".bmi-calculator-button").on("click",function(){var b=a(this).parent().parent(),c=a(b.find('input[type="radio"]:checked')[0]),d=c.val();if("imperial"==d)var e=b.find(".bmi-calculator-dimensions-imperial select"),f=parseFloat(a(e[0]).val()),g=parseFloat(a(e[1]).val()),h=parseFloat(a(b.find('.bmi-calculator-dimensions-imperial input[type="text"]')[0]).val()),i=a.calculateBMI(a.FtInToIn(f,g),h,d);else var j=b.find('.bmi-calculator-dimensions-metric input[type="text"]'),k=parseFloat(a(j[0]).val()),h=parseFloat(a(j[1]).val()),i=a.calculateBMI(k/100,h,d);if(isNaN(i)||0==i){var l=a(b.find(".bmi-calculator-results")[0]);return l.removeClass("none"),l.removeClass("healthy"),l.removeClass("caution"),l.removeClass("unhealthy"),void l.addClass("none")}var l=a(b.find(".bmi-calculator-results")[0]);l.removeClass("none"),l.removeClass("healthy"),l.removeClass("caution"),l.removeClass("unhealthy"),l.addClass(a.getAlertStatus(i)),l.html("BMI: "+i+"<br/>"+a.getWHOclassification(i))}),a(".bmi-calculator-system-radio").on("click",function(){var b=a(this).parent().parent().parent(),c=b.find(".bmi-calculator-dimensions-imperial select");a(c[0]).val(1),a(c[1]).val(0),a(b.find('.bmi-calculator-dimensions-imperial input[type="text"]')[0]).val(0);var d=b.find('.bmi-calculator-dimensions-metric input[type="text"]');a(d[0]).val(0),a(d[1]).val(0);var e=a(b.find(".bmi-calculator-results")[0]);e.removeClass("none"),e.removeClass("healthy"),e.removeClass("caution"),e.removeClass("unhealthy"),e.addClass("none");var f=b.find('input[type="radio"]');f.each(function(){a(this).prop("checked",!1)}),a(this).prop("checked",!0);var g=a(this).val();"imperial"==g?(a(b.find(".bmi-calculator-dimensions-imperial")[0]).css("display","block"),a(b.find(".bmi-calculator-dimensions-metric")[0]).css("display","none")):(a(b.find(".bmi-calculator-dimensions-imperial")[0]).css("display","none"),a(b.find(".bmi-calculator-dimensions-metric")[0]).css("display","block"))}),a.calculateBMI=function(a,b,c){var d=0;return d="imperial"==c?703*b/Math.pow(a,2):b/Math.pow(a,2),Math.round(100*d)/100},a.FtInToIn=function(a,b){return 12*a+b},a.getAlertStatus=function(a){return a<16||a>=40?"unhealthy":a<18.5||a>=25?"caution":"healthy"},a.getWHOclassification=function(a){return a<16?"Severe Thinness":a<17?"Moderate Thinness":a<18.5?"Mild Thinness":a<25?"Normal Range":a<30?"Pre-obese":a<35?"Obese Class I":a<40?"Obese Class II":"Obese Class III"}})}(jQuery);